var mysql = require("mysql");

var mycatDb = {
  host: "47.103.36.143",
  port: 3310,
  user: "root",
  password: "123456",
  database: "wx_one"
};

var connection = mysql.createConnection(mycatDb);

connection.connect();

var id = '1';
var columns = ['id', 'name'];

var sql = `SELECT ${columns} from  user where  (?!=null&&id=?) `;

console.log(sql, "sql");

connection.query(sql, [null], function (error, results, fields) {
  if (error) throw error;
  console.log(results, "rows");
});
